package com.android.home.adapter.holder;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.constraintlayout.utils.widget.ImageFilterView;
import com.android.common.base.rv.BaseMultiSelectRvHolder;
import com.android.home.R;
import com.android.home.mvp.model.home.MultiSelectListBean;

public class MsgListHolder extends BaseMultiSelectRvHolder<MultiSelectListBean.RowsBean> {
    /**
     * （0；非误报；1：是误报 ）
     */
    public static final String UN_MIS_REPORT = "0";
    public static final String MIS_REPORT = "1";
    public static final String REPORTED = "1";
    private final Context mContext;
    private final ImageView mIvReadFlag;
    private final ImageView mIvReportedFlag;
    private final ImageView mIvMisReportedFlag;
    private final ImageFilterView mIfvIcon;
    private final TextView mTvName;
    private final TextView mTvTitle;
    private final TextView mTvTime;

    public MsgListHolder(View itemView) {
        super(itemView);
        mContext = itemView.getContext();
        mIvReadFlag = itemView.findViewById(R.id.iv_read_flag);
        mIvReportedFlag = itemView.findViewById(R.id.iv_reported_flag);
        mIvMisReportedFlag = itemView.findViewById(R.id.iv_mis_report_flag);
        mIfvIcon = itemView.findViewById(R.id.ifv_icon);
        mTvTitle = itemView.findViewById(R.id.tv_title);
        mTvName = itemView.findViewById(R.id.tv_name);
        mTvTime = itemView.findViewById(R.id.tv_time);
    }

    @Override
    public void bindData(MultiSelectListBean.RowsBean bean, int position) {
        super.bindData(bean,position);
        if (REPORTED.equals(bean.getReportFlag())) {
            mIvReportedFlag.setVisibility(View.VISIBLE);
            mIvReportedFlag.setImageResource(R.mipmap.reported);
        }else {
            mIvReportedFlag.setVisibility(View.GONE);
        }

        if (MIS_REPORT.equals(bean.getMisreportFlag())) {
            mIvMisReportedFlag.setVisibility(View.VISIBLE);
            mIvMisReportedFlag.setImageResource(R.mipmap.wrong);
        }else {
            mIvMisReportedFlag.setVisibility(View.GONE);
        }

        mTvTitle.setText("智能识别" +" ("+ bean.getEventName() +")");
        mTvName.setText(bean.getReportVideoname());
        mTvTime.setText(bean.getReportTime());
        mIfvIcon.setImageResource(R.mipmap.settings);
//        GlideUtils.with().loadTokenImage(bean.getAttachmentUrlPublic(), mIfvIcon);
    }
}
